//https://leetcode.cn/problems/he-wei-sde-liang-ge-shu-zi-lcof/description/

class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int left = 0, right = price.size() - 1;
        while (left < right)
        {
            if (target < price[left] + price[right])
            {
                right--;
            }
            else if (target > price[left] + price[right])
            {
                left++;
            }
            else
            {
                return { price[left],price[right] };
            }
        }

        //保证所有路径都有返回值
        return { -1,-1 };

    }
};